/**
 * @author smallwang
 * @email justdoalitter@gmail.com
 * @create date 2025-01-30 02:17:54
 * @modify date 2025-01-30 02:17:54
 * @desc [description]
 */
package ltd.smallwang;

import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;

import ltd.smallwang.common.ListNode;

class Leetcode0142Test {
  private Leetcode0142 leetcode0142 = new Leetcode0142();

  @Test
  void testDetectCycle() {
    ListNode head = new ListNode(3);
    head.next = new ListNode(2);
    head.next.next = new ListNode(0);
    head.next.next.next = new ListNode(-4);
    head.next.next.next.next = head.next;

    ListNode result = leetcode0142.detectCycle(head);
    Assertions.assertThat(result.val).isEqualTo(2);
  }
}
